<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<ui:composition>
	<h:form id="idConselho">
		<p:panel>
			<h:panelGroup>
				<p:outputLabel rendered="#{relato.anonimo}" value="Alguém"
					style="color:green; font-weight: bold;" />
				<h:outputLink rendered="#{!relato.anonimo}"
					style="color:green; font-weight: bold;"
					value="perfil.jsf?user=#{relato.usuario.id}">
										#{relato.usuario.nome}
									</h:outputLink>
				<p:outputLabel
					value=" quer conselho  sobre #{relato.tipo.descricao}"
					style="color:green; font-weight: bold;" />
			</h:panelGroup>
			<div align="center">
				<p:separator style="width: 100%" />
			</div>
			<p
				style="padding-left: 10px; padding-right: 10px; font-family: serif; border: thin; font-size: large; border-color: black; max-width: inherit;">
				#{relato.descricao}</p>
			<p:separator />
			<p:dataGrid id="panelConselhos" var="conselho"
				value="#{relato.conselhos}" columns="1" rows="10" paginator="false"
				emptyMessage="Ainda não há conselhos para este relato">
				<ui:include src="/WEB-INF/include/conselho.xhtml">
					<ui:param name="conselho" value="#{conselho}" />
				</ui:include>
			</p:dataGrid>
			<h:panelGroup
				rendered="#{sessaoBean.usuario.id != relato.usuario.id}">
				<p:separator />
				<p:commandButton id="aconselharButton" process="@this"
					oncomplete="dialogAconselhar.show()"
					value="Aconselhar">
					<f:setPropertyActionListener value="#{relato}"
						target="#{postBean.relatoSelecionado}" />
				</p:commandButton>
				<p:commandButton id="buttonSeguirRelato" update=":panelRelatos"
					value="Seguir relato"
					action="#{postBean.seguirRelato(relato)}"
					style="margin-right: 10px"
					rendered="#{!sessaoBean.usuario.isSegueRelato(relato)}">
					<f:setPropertyActionListener value="#{relato}"
						target="#{postBean.relatoSelecionado}" />
				</p:commandButton>
				<p:commandButton id="buttonDesfazerSeguirRelato"
					update=":panelRelatos" value="Seguindo relato (desfazer)"
					action="#{postBean.desfazerSeguirRelato(relato)}"
					style="margin-right: 10px"
					rendered="#{sessaoBean.usuario.isSegueRelato(relato)}">
					<f:setPropertyActionListener value="#{relato}"
						target="#{postBean.relatoSelecionado}" />
				</p:commandButton>
			</h:panelGroup>

		</p:panel>
	</h:form>
</ui:composition>

</html>